class DeliveryMan < ActiveRecord::Base
  # Il fattorino possiede una account e appartiene ad una pizzeria!
  has_one :account, :as => :user, :validate => true
  has_many :orders
  belongs_to :restaurant

  validates_presence_of :name, :surname, :phonenumber, :vehicle
  validates_numericality_of :phonenumber, :only_integer => true
  validates_each :name, :surname do |record, attr, value|
    value.downcase!
    value.capitalize!
  end
end
